home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / make / icmake-6.000 / icmake-6 / icmake / exec / funpushs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-08  |  1.0 KB  |  42 lines

  1. /*
  2. \funcref{fun\_push\_strconst} {void fun\_push\_strconst ()}
  3.     {}
  4.     {}
  5.     {getint16(), getstring(), error(), push()}
  6.     {}
  7.     {funpushs.c}
  8.     {
  9.  
  10.         This function is called when a string constant is to be pushed onto the
  11.         stack. The offset of the string to be pushed, relative to the strings
  12.         section of the binary makefile, is expected to follow the opcode. This
  13.         relative offset is an {\em UNS16} variable.
  14.  
  15.         A variable of type {\em e\_str} and with field {\em vu.str} set to
  16.         a duplicate of the string constant is pushed.
  17.  
  18.     }
  19. */
  20.  
  21. #include "icm-exec.h"
  22.  
  23. void fun_push_strconst ()
  24. {
  25.     UNS16
  26.         offs;
  27.     register char
  28.         *str;
  29.     VAR_
  30.         tmp;
  31.  
  32.     offs = (UNS16) getint16 (infile);
  33.  
  34.     if ( (str = getstring (infile, headerp->offset[0], offs)) == (char *) -1 )
  35.         error ("cannot get string, opcode at %s", hexstring (curoffs, 4));
  36.  
  37.     tmp = newvar (e_str);
  38.     tmp.vu.i->ls.str = str;        /* note: str is already alloced */
  39.                     /* due to getstring () */
  40.     push (tmp);
  41. }
  42.